"""
@author: xxw
@file: 冒泡排序.py
@time: 2023/8/14 17:21
"""

def bubble_sort(arr):
    length = len(arr)
    for i in range(length):
        for j in range(0,length - i -1):
            if arr[j+1] < arr[j]:
                arr[j], arr[j+1] = arr[j+1], arr[j]
    return arr

arr = [32,23,5,3,2,54,4,2,5,1]
print(bubble_sort(arr))